/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Network;

import com.sun.security.ntlm.Client;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author ThuyHuynh
 */
public class Connection extends Thread{
   
    ObjectInputStream inp;
    ObjectOutputStream out;
    int port;
    public Connection(int port){
        this.port=port;
    }
    public void run()
    {

            try {
                Socket sk  = new Socket("localhost",port);
                out = new ObjectOutputStream(sk.getOutputStream());
                inp= new ObjectInputStream(sk.getInputStream());
                
                new ReadWrite(out, inp).start();
                
            } catch (IOException ex) {
                JOptionPane.showMessageDialog(null, "Server chưa khởi động hoặt sai port");
            }
            
    }
}
